<template>
	 <el-input v-model="value">
		<template #append>
			<el-button @click="toOpen">选择</el-button>
		</template>
	 </el-input>
 	 <mdp-dialog ref="dialog"> 
			<template #default="{dialog}">
				<mdp-table subOpType="select" :operWidth="120" :pageable="false" v-model="value" :columnCfgs="columnCfgs" :crudApis="crudApis" @select="(d)=>{value=d.id;dialog.close()}"/>
			</template> 
	 </mdp-dialog>
</template> 
<script> 
import {listDataSet} from '@/api/mdp/dm/dataSet'
export default {
	name: 'MdpInputDataSet', 
	props: {
		modelValue: {
			type:String,
			default:function(){
				return null
			}
		}
	},
	data(){
		return {  
			columnCfgs:[
				{label:'数据集编号',property:'id'},
				{label:'数据集描述',property:'title'}
			],
			crudApis:{
				list:listDataSet
			}
		}
	},
	computed: {
		value:{
			set(val){
				this.$emit('update:modelValue',val)
			},
			get(){
				return this.modelValue
			}
		}
	}, 
	methods:{  
		toOpen(){  
			this.$refs['dialog'].open({})
		}
	},
	mounted() { 
		 
	}
}
</script>
